{% extends "index.html" %}
{% load cms_tags %}
{% load cache menu_tags %}
{% load navigation_tags %}
{% block title %}{{ title }}{% endblock %}

{% block style %}
	<link href="/_s_/css/base.css" rel="stylesheet" type="text/css">
{% endblock %}

{% block menu %}
		{% cms_navigation title %}
		{% if user.is_authenticated %}
    		{{ user.username }}
    	{% endif %}
{% endblock %}

{% block main %}
	{% if catalog %}
		<table width="100%"><tr>
		{% for sec, obj in catalog|get_items %}
			<td><table width="100%">
			<tr class="sec"><th>{{ sec }}</th></tr>
			{% for cat in obj %}
				{% if forloop.counter|divisibleby:"2" %}
				<tr class="cat_2"><td><a href="{% url catalog.views.get_cat cat.id %}"><li>{{ cat.name }}</li></a></td></tr>
				{% else %}
				<tr class="cat_1"><td><a href="{% url catalog.views.get_cat cat.id %}"><li>{{ cat.name }}</li></a></td></tr>
				{% endif %}
			{% endfor %}
			</table></td>
			{% if forloop.counter|divisibleby:"3" %}
				</tr><tr>
			{% endif %}
		{% endfor %}
		</tr></table>
	{% endif %}
	
	{% if catalog_sec %}
		<table width="100%"><tr>
		{% for sec, obj in catalog_sec|get_items %}
			<td><table width="100%">
			<tr class="sec"><th>{{ sec }}</th></tr>
			{% for cat in obj %}
				{% if forloop.counter|divisibleby:"2" %}
				<tr class="cat_2"><td><a href="{% url catalog.views.get_pr cat.id %}"><li>{{ cat.name }}</li></a></td></tr>
				{% else %}
				<tr class="cat_1"><td><a href="{% url catalog.views.get_pr cat.id %}"><li>{{ cat.name }}</li></a></td></tr>
				{% endif %}
			{% endfor %}
			</table></td>
			{% if forloop.counter|divisibleby:"3" %}
				</tr><tr>
			{% endif %}
		{% endfor %}
		</tr></table>
	{% endif %}
	
	{% if product %}
		<table width="100%"><tr>
			<td><table width="100%">
				<tr class="sec"><th>{{ product|get_cat }}</th></tr>
				{% for pr in product %}
					{% if forloop.counter|divisibleby:"2" %}
						<tr class="cat_2"><td><a href="{% url catalog.views.get_pr pr.id %}"><li>{{ pr.name }}</li></a></td></tr>
					{% else %}
						<tr class="cat_1"><td><a href="{% url catalog.views.get_pr pr.id %}"><li>{{ pr.name }}</li></a></td></tr>
					{% endif %}
				{% endfor %}
			</table></td>
		</tr></table>
	{% endif %}
	
	{% if the_product %}
		<div class="col1_ar">
                	<table cellspacing="0" cellpadding="0">
                	  <tr>
                	    <td rowspan="4" valign="top" width="20%"><br>
                	      <img src="/media/{{ the_product.img }}" alt="{{ the_product.name }}" border="0"><br>
                	      <br></td>
                	    <td rowspan="1" colspan="2"><h1>{{ the_product.name }}</h1></td>
              	    </tr>
                	  <tr>
                	    <td align="left" valign="top" width="33%"><strong>Цена за шт. (шт.):</strong> {{ the_product.price }} руб<br></td>
                	    <td valign="top"><br></td>
              	    </tr>
                	  <tr>
                	    <td colspan="2"><a href="mailto: nv-soft@list.ru">Задайте вопрос по этому товару</a></td>
              	    </tr>
                	  <tr>
                	    <td rowspan="1" colspan="2"><hr>
                	    {{ the_product.description|safe }}  
                	    </td>
              	    </tr>
              	  </table>
    	  		</div>
	{% endif %}
{% endblock %}

{% block col2 %}
{% if pr_rand %}
<div class="col2_ar">
  	<p>Другие товары из категории: {{ pr_rand|get_sec }}</p><hr/>
  	<ul>
  		{% for pr in pr_rand %}
		<li>
   			<a href="{% url catalog.views.get_pr pr.id %}">{{ pr.name }}<br/>
   			Цена за шт. (шт.): {{ pr.price }} руб</a>
        </li>
        {% endfor %}
    </ul>
</div>
{% endif %}
{% endblock %}
